<template>
	<div class="mine-container ">
        <myNavbar title="常见问题"></myNavbar>
		<list>
			<cell>
				<div class="question">
					<div class="main" v-for="item in questionList" :key="item.id">
						<div class="item" @click="detailClick(item.title)">
							<text class="item-text">{{ item.title }}</text>
							<icon class="item-icon" content="tb-right"></icon>
						</div>
					</div>
				</div>
			</cell>
		</list>

	</div>
</template>
<script>
import { list, tag } from '../../../api/article';
const eeui = app.requireModule('eeui');
import myNavbar from '../../../components/myNavbar/myNavbar.vue'
export default {
	name: '',
	components: {myNavbar},
	filters: {}, // 过滤器
	data() {
		return {
			questionList: [],
			tagIds: ''
		};
	},
	created() {
		this.initQuestion();
	},
	methods: {
		initQuestion() {
			let params = {
				mchId: this.getGlobalData().mchId,
				type: 0
			};
			tag(params)
				.then(res => {
					res.data.data.forEach(item => {
						if (item.name == '常见问题') {
							this.tagIds = item.id;
							// 查找常见问题
							list({ mchId: this.getGlobalData().mchId, tagIds: this.tagIds })
								.then(res2 => {
									console.log(res2, '查找常见问题');
									this.questionList = res2.data.data;
								})
								.catch(err => {
									console.log(err);
								});
						}
					});
				})
				.catch(err => {
					console.log(err);
				});
		},
		detailClick(title) {
			/* eeui.openPage({ url: `root://pages/member/detail/detail?mchId=${this.getGlobalData().mchId}&tagIds=${this.tagIds}&title=${title}` }, result => {
				console.log('跳转到详情页成功');
			}); */
			let params = {
				mchId: this.getGlobalData().mchId,
				tagIds: this.tagIds,
				title
			}
			eeui.openPage({ url: 'root://pages/member/detail/detail.js', params, statusBarType: "immersion", statusBarStyle:false }, result => {
				console.log('跳转到详情页成功');
			});
		}
	}
};
</script>

<style scoped>
.mine-container {
	background-color: rgba(248, 248, 248, 1);
}
.question {
	width: 750px;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-top: 54px;
}
.main {
	width: 712.5;
	background-color: #fff;
}
.item {
	padding: 20px;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
}
.item-text {
	font-size: 28px;
	font-family: PingFangSC;
	font-weight: 400;
	color: #1a1a1e;
}
.item-icon {
	width: 50px;
	height: 50px;
	font-size: 50px;
	color: #cccccc;
}

.page-navbar {
	width: 750px;
	height: 90px;
}
.page-navbar-title {
	color: #ffffff;
	font-size: 28px;
}
</style>
